import HttpRequest from "../request";

/**
 * 获取我的购物车
 *
 */
export async function getAllCar(params) {
  return HttpRequest({
    url: "/car",
    method: "GET",
    params: params,
  });
}

/**
 * 根据id修改购物车信息
 *
 */
export async function updateCarById(id, params) {
  return HttpRequest({
    url: `/car/${id}`,
    method: "PATCH",
    params: params,
  });
}

/**
 * 新增商品到购物车
 *
 */
export async function addProductToCar(params) {
  return HttpRequest({
    url: `/car`,
    method: "POST",
    params: params,
  });
}

/**
 * 删除购物车
 *
 */

export async function clearCar(params) {
  return HttpRequest({
    url: `/car`,
    method: "DELETE",
    params: params,
  });
}
